import java.util.ArrayList;
import java.util.Arrays;

public class Solution21 {
    public static void main(String[] args) {
        Solution21 solution21=new Solution21();
        int[] g={10,9,8,7};
        int[] s ={5,6,7};
        int contentChildren = solution21.findContentChildren(g, s);
        System.out.println(contentChildren);

    }
    public int findContentChildren(int[] g, int[] s) {
        Arrays.sort(g);
        Arrays.sort(s);
        int gcount =0;
        int scount=0;
        while(gcount<g.length&&scount<s.length){
            if(g[gcount]<=s[scount]){
                gcount++;
            }
            scount++;
        }
        return gcount;
    }

}
